<?php

namespace App\Ad\Postback\Handle;

use App\Models\Log\LogAdPostback;

class PostbackBase
{
    protected $log;

    public function __construct(LogAdPostback $log)
    {
        $this->log = $log;
    }

    public function handle()
    {
        //
    }

    // 更新状态
    protected function updateStatus($status, $save = false)
    {
        $this->log->status = $status;
        $this->log->status_time = time();

        if ($save) {
            $this->log->save();
        }
    }

    // 更新处理次数
    protected function updateCheckNum($save = false)
    {
        $this->log->check_num++;
        $this->log->check_time = time();

        if ($save) {
            $this->log->save();
        }
    }
}
